# -*- coding: utf-8 -*-
import scrapy


class EmailSpider(scrapy.Spider):
    name = 'email'
    allowed_domains = ['www.youtube.com']
    custom_settings = {
        'DOWNLOADER_MIDDLEWARES': {
            'youtube_spider.middlewares.SeleniumMiddleware': 300,
        }
    }
    def start_requests(self):  
        request = scrapy.Request(
            'https://www.youtube.com/channel/UCHRXYmO1vdp-Bi1-w11R7WQ'
            ,callback=self.parse
            )
        yield request

    def parse(self, response):
        # title = response.xpath('//span[@id="channel-title"]').extract_first()
        # print(title)       
        html = str(response.body)
        #print(html)
        with open('debug.html', 'w') as f:
            f.write(html)

            
    
   
